package org.afk.sisy.gui.swing;

import java.net.*;

import javax.swing.*;

public class Icons
{
	private static final String IMG_SOURCE_FOLDER = "img/";

	private static final String ADD = "add.png";
	private static final String ERROR = "emoticon_sad.png";
	private static final String DELETE_PROJECT = "trash_can.png";
	private static final String FRAME_ICON = "sisy.jpg";
	private static final String RUN_ICON = "play.png";
	private static final String OPEN = "folder.png";

	private final ImageIcon openIcon;
	private final ImageIcon addIcon;

	private final ImageIcon frameIcon;

	private final ImageIcon errorIcon;

	private final ImageIcon deleteIcon;

	private final ImageIcon runIcon;

	public Icons()
	{
		this.errorIcon = loadIcon(IMG_SOURCE_FOLDER + ERROR);
		this.addIcon = loadIcon(IMG_SOURCE_FOLDER + ADD);
		this.frameIcon = loadIcon(IMG_SOURCE_FOLDER + FRAME_ICON);
		this.deleteIcon = loadIcon(IMG_SOURCE_FOLDER + DELETE_PROJECT);
		this.runIcon = loadIcon(IMG_SOURCE_FOLDER + RUN_ICON);
		this.openIcon = loadIcon(IMG_SOURCE_FOLDER + OPEN);
	}

	private ImageIcon loadIcon(final String string)
	{
		final URL imgUrl = ClassLoader.getSystemResource(string);
		if (imgUrl != null)
			return new ImageIcon(imgUrl, "sisy");
		return new ImageIcon();
	}

	public ImageIcon getAddIcon()
	{
		return this.addIcon;
	}

	public ImageIcon getDeleteIcon()
	{
		return this.deleteIcon;
	}

	public ImageIcon getErrorIcon()
	{
		return this.errorIcon;
	}

	public ImageIcon getFrameIcon()
	{
		return this.frameIcon;
	}

	public ImageIcon getOpenIcon()
	{
		return this.openIcon;
	}

	public ImageIcon getRunIcon()
	{
		return this.runIcon;
	}

}
